package com.hesicare.untils.dynamicDataSource;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;

@Configuration
public class JdbcTemplateConfig {

    @Bean
    JdbcTemplate master(@Qualifier("dbMaster") DataSource dbMaster) {
        return new JdbcTemplate(dbMaster);
    }

    @Bean
    JdbcTemplate jdbcTemplateHis(@Qualifier("his") DataSource his) {
        return new JdbcTemplate(his);
    }

    @Bean
    JdbcTemplate jdbcTemplateSlave2(@Qualifier("dbSlave2") DataSource slave2) {
        return new JdbcTemplate(slave2);
    }
}
